const express = require('express');
const router = express.Router();
const foodController = require('../controllers/foodController');
const auth = require('../middlewares/auth');

// 公开路由
router.get('/', foodController.getFoods);

// 需要认证的路由
router.get('/my', auth, foodController.getMyFoods);
router.post('/', auth, foodController.addFood);
router.put('/:id', auth, foodController.updateFood);
router.delete('/:id', auth, foodController.deleteFood);

// ID查询放在最后
router.get('/:id', foodController.getFoodById);

module.exports = router; 